<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;

use App\Models\DedustingDevice;
use App\Models\DedustingDevicePoint;
use App\Models\DedustingDeviceData;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Redis;

use Swoole\Coroutine;
use Swoole\Timer;
use Illuminate\Support\Str;

// use Illuminate\Support\Facades\DB;
// use Illuminate\Support\Facades\Redis;

class DedustingData extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'dedusting-data';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'description';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command. 
     *
     * @return mixed
     */
    public function handle()
    {

        DedustingDevice::statusAndAlive();
        return;
error_log(" = ".print_r(date("H:i:s"), 1)."\n",3,'/tmp/joker.log');
        while (true) {
            $time = date("H:i:s");
            var_dump($time);

            DedustingDeviceData::setDbData();

            sleep(60);
        }

        return;
        $time = date("H:i:s");
        var_dump($time);

        DedustingDeviceData::setDbData();
        // DedustingDevice::statusAndAlive();

        return;
    }
}
